package com.icss.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.icss.model.Item;
import com.icss.model.Manager;
import com.icss.model.User;

public interface UserDao {
	@Select("select id,name,pass from user where name=#{name} and pass=#{pass}")
	public User login(User u);
	//查找用户名
	@Select("select id,name,pass from user where name=#{name}")
	public User findByname(String name);
	//找密码
	@Select("select id,name,tel from user where tel=#{tel}")
	public User findBypass(String pass);
	//注册
	@Insert("insert into user values(default,#{name},#{pass},#{tel},default)")
	public int reg(User u);
	//管理员登录
	@Select("select id,name,pass from manager where name=#{name} and pass=#{pass}")
	public Manager mLogin(@Param("name")String name,@Param("pass")String pass);
	
	@Select("select id,name,price,itemcate,url1,data from item where itemcate = #{id}")
	public List<Item> findByTe(int id);
}
